<template>
  <div class="container">
    <error-tip :errorCode="errorCode" v-if="errorCode"></error-tip>
    <div v-else>
      <day-card :data = "dayData"></day-card>
      <day-list :data = "dayData"></day-list>
    </div>
  </div>
</template>

<script>
import { computed, onMounted } from '@vue/runtime-core';
import getData  from '@/services'
import {getNowDate} from '@/libs/utils'
import { useStore } from 'vuex';
import ErrorTip from '@/conponents/ErrorTip/'
import DayCard from '@/conponents/DayPage/Card.vue'
import DayList from '@/conponents/DayPage/List.vue'

export default {
  setup(){
    const store = useStore()
    onMounted(() =>{
      const field = store.state.field
      getData(store,field,getNowDate(field))
    })
    
    return {
      dayData:computed(() => store.state.dayData),
      errorCode:computed(() => store.state.errorCode)
    }
    
  },
  components: {
    DayCard,
    DayList,
    ErrorTip
  }
};
</script>

<style></style>
